﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EmbeddedSharp.Core;
using System.Drawing;
using System.IO;

namespace Zove.Desktop.Function
{
    public class LoadImage : FuncNode
    {
        public LoadImage()
            : base("loadImage")
        {
        }

        public override object Evaluate()
        {
            int length = Parameters.Count;
            if (length < 1)
            {
                throw new ArgumentException("");
            }

            string fileName = Convert.ToString(
                Parameters[length-1].Evaluate());
            Image image = Image.FromFile(fileName);

            return image;
        }
    }
}
